/**
 *
package com.csii.user.util;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.csii.core.util.DateUtils;
import com.csii.user.entity.SysTenant;
import com.csii.user.service.ISysJobService;
import com.csii.user.service.ISysTenantService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

@Component
@Slf4j
@Transactional(rollbackFor=Exception.class)
public class SchedulerUtil {

    @Autowired
    private ISysTenantService sysTenantService;

    @Autowired
    private ISysJobService sysJobService;

    @Scheduled(cron = "0 0 21 ? * MON")
    public void deleteMsgByStatus(){
        log.info(String.format(" power-stdio 删除业务表中已被删除的租户信息 deleteMsgByStatus !  时间:" + DateUtils.getTimestamp()));
        //查询租户表中已经(逻辑)删除数据ID
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("status",2);
        try{
            List<SysTenant> sysTenantList= sysTenantService.list(queryWrapper);
            if(sysTenantList!=null && sysTenantList.size()>0){
                int count=0;
                String[] ids=new String[sysTenantList.size()];
                for(SysTenant sysTenant:sysTenantList){
                    ids[count]=sysTenant.getId();
                    count++;
                }
                //查询所有包含tenant_id的业务表
                String table_name="'power-stdio'";
                String COLUMN_name="'tenant_id'";
                String sql="select table_name from information_schema.COLUMNS where table_schema = "
                        +table_name+"and COLUMN_name="+COLUMN_name+"and table_name like  'act_re%' ";
                List<String> list=sysJobService.executeSelect(sql);
                //物理删除业务表中已经被删除租客用户数据
                for(String tableName:list){
                    sysJobService.deleteMshJob(tableName,ids);
                }
                //物理删除租客表中的数据
                sysTenantService.removeByIds(Arrays.asList(ids));
                log.info(String.format("业务表中的租客信息删除成功。 时间:" + DateUtils.getTimestamp()));
            }else{
                log.info(String.format("系统中没有被删除的租客。 时间:" + DateUtils.getTimestamp()));
            }
        }catch (Exception e){
            log.error(String.format("业务表中的租客信息删除失败。 原因:" + e.getMessage()));
            throw  e;
        }
    }
}
*/
